package com.aifast.common.layui;

import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ObjectUtil;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

@Data
@Builder
@NoArgsConstructor
public class LayuiDataTable<T> implements Serializable {

    private static final long serialVersionUID = 1741817428627755376L;

    private int code;

    private String msg;

    private List<T> data;

    private long count;

    public LayuiDataTable(int code, String msg, List<T> data, long count) {
        this.code = code;
        this.msg = msg;
        this.count = count;
        this.data =(ObjectUtil.isNull(data) || data.size() ==0 ) ? ListUtil.empty() : data;
    }

}
